import request from '@/utils/request'

// 获取组织结构数据
// 配置url ,请求方式,参数 data params
export function getDepartments() {
  return request({
    url: '/company/department'
  })
}
// 新增子部门 /company/department
export function addDepartment(data) {
  return request({
    url: '/company/department',
    method: 'post',
    data
  })
}
// 根据id获取部门表单信息 /company/department/{id}
export function getDepartmentDetails(id) {
  return request({
    url: `/company/department/${id}`
  })
}
// 根据ID修改部门详情/company/department/{id}
export function editDepartment(data) {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}

// 根据ID删除部门 /company/department/{id}
export function delDepartment(id) {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}
